<template>
  <el-form
    ref="baseForm"
    label-suffix=":"
    :model="accountInfo"
    label-width="100px"
    class="accountFrom"
  >
    <el-form-item label="账户余额" prop="balance" style="width: 50%">
      <el-input
        type="input"
        v-model="accountInfo.balance"
        placeholder=""
      />
    </el-form-item>
    <el-form-item label="累计收益" prop="totalIncome" style="width: 50%">
      <el-input
        type="input"
        v-model="accountInfo.totalIncome"
        placeholder=""
      />
    </el-form-item>
  </el-form>
</template>

<script>
import BaseForm from "@/base-ui/form";
import {get} from "@/utils/request";

export default {
  components: {
    BaseForm,
  },
  name: "account",
  data() {
    return{
      accountInfo: {
        account: 0,
        totalIncome:0
      }
    }
  },
  methods:{
    getUserBalance(){
      get("/mobile/purse/getPurseBalance",{}).then((res)=>{
        this.accountInfo.balance=res.data;
      });
    },
    getEarningsStatistics(){
      get("/mobile/purse/getEarningsStatistics",{}).then((res)=>{
        this.accountInfo.totalIncome=res.data.count;
      });
    }
  },
  mounted(){
    this.getUserBalance();
    this.getEarningsStatistics();
  }
}
</script>

<style scoped>
.accountFrom {
  margin-top: 10px;
}
</style>
